package com.example.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.SysUserMapper;
import com.example.pojo.SysUser;
import com.example.service.SysUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 23818
 * @description 针对表【sys_user】的数据库操作Service实现
 * @createDate 2023-06-21 16:36:24
 */
@Service

public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
        implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;

    @Cacheable(value = "UserList",key = "#page+'-'+#sysUser+'-'+#EName")
    @Override
    public Page<SysUser> findAllUsers(Page<SysUser> page, SysUser sysUser, String EName) {
        return sysUserMapper.findAllUsers(page, sysUser, EName);
    }
    @Cacheable(value = "UserList",key = "#pageNo+'-'+#pageSize+'-'+#sysUser+'-'+#EName")
    @Override
    public PageInfo<SysUser> findAllUsersList(Integer pageNo, Integer pageSize, SysUser sysUser, String EName) {
        PageHelper.startPage(pageNo, pageSize);
        List<SysUser> allUsersList = sysUserMapper.findAllUsersList(sysUser, EName);
        return new PageInfo<>(allUsersList);
    }
}




